import axios from '../axios.js'

export default {
    // 获取活期数据
    getCurrentData(params) {
        return axios({
            url: '/currentFundInfo/selectAll',
            method: 'get',
            params
        })
    },
    // 删除数据
    delCurrentData(data) {
        return axios({
            url: "/currentFundInfo/delete",
            method: "POST",
            data
        })
    },
    // 新增数据
    addCurrentData(data) {
        return axios({
            url: '/currentFundInfo/insertOne',
            method: 'POST',
            headers: {
                'Content-Type': 'application/x-www-form-urlencoded'
            },
            transformRequest: [
                function (data) {
                    let ret = ''
                    for (let it in data) {
                        ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&'
                    }
                    ret = ret.substring(0, ret.lastIndexOf('&'));
                    return ret
                }
            ],
            data
        })
    }
}